package com.itheima.demo6collection;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

public class CollectionDemo2 {
    public static void main(String[] args) {
//        目标：搞清楚Collection提供的通用功能集合
        Collection<String> list = new ArrayList<>();
        list.add("张三");
        list.add("李四");
        list.add("王五");
        System.out.println(list);
        list.remove("张三");
        System.out.println(list);
        boolean b = list.contains("李四");
        System.out.println(b);
        int size = list.size();
        System.out.println(size);
        boolean empty = list.isEmpty();
        System.out.println(empty);
        list.clear();
        System.out.println(list);
        boolean b1 = list.isEmpty();
        System.out.println(b1);
        list.add("张三");
        list.add("李四");
        list.add("王五");
//        把集合转化成数组
        Object[] arr = list.toArray();
        System.out.println(Arrays.toString(arr));
        String[] arr1 = list.toArray(String[]::new);
        System.out.println(Arrays.toString(arr1));
    }
}